﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EnvDTE;
using EnvDTE80;

namespace BovespaDesignRules
{
    public sealed class Rule_DoNotCreateSingleValueEnum : BaseAddIn.Rules.BaseRuleAddIn
    {
        #region Constructor

        public Rule_DoNotCreateSingleValueEnum()
            : base("BovespaDoNotCreateSingleValueEnum", "BovespaDesignRules.BovespaDesignRules", typeof(Rule_DoNotCreateSingleValueEnum).Assembly)
        {
        }

        #endregion

        #region Protected Override Methods

        protected sealed override void Check(CodeEnum enumElement, CodeNamespace namespaceElement, CodeClass2 classe)
        {
            if (enumElement.Children == null
                || enumElement.Children.Count == 0
                || enumElement.Children.Count == 1)
            {
                GeraProblemaAddIn(enumElement.StartPoint.Parent.Parent.FullName,
                                  enumElement.StartPoint.Line,
                                  enumElement.StartPoint.DisplayColumn,
                                  "DoNotCreateSingleValueEnumResolution",
                                  classe.Name,
                                  enumElement.Name,
                                  namespaceElement.Name);
            }
        }

        #endregion
    }
}
